#pragma once
#include "pch.h"
#include "class_log.h"
#include "class_bars.h"
#include "class_tick.h"
#include "class_position.h"
#include "class_strategy_position.h"


class class_center
{
public:

//行情类定义
class class_md_spi :
public CThostFtdcMdSpi
{
public:
//行情SPI构造
class_md_spi(class class_center*);
//行情SPI析构
~class_md_spi();

///当客户端与交易后台建立起通信连接时（还未登录前），该方法被调用。
void OnFrontConnected();

///当客户端与交易后台通信连接断开时，该方法被调用。当发生这个情况后，API会自动重新连接，客户端可不做处理。
///@param nReason 错误原因
///        0x1001 网络读失败
///        0x1002 网络写失败
///        0x2001 接收心跳超时
///        0x2002 发送心跳失败
///        0x2003 收到错误报文
void OnFrontDisconnected(int nReason);

///心跳超时警告。当长时间未收到报文时，该方法被调用。
///@param nTimeLapse 距离上次接收报文的时间
void OnHeartBeatWarning(int nTimeLapse);


///登录请求响应
void OnRspUserLogin(CThostFtdcRspUserLoginField* pRspUserLogin, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///登出请求响应
void OnRspUserLogout(CThostFtdcUserLogoutField* pUserLogout, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///错误应答
void OnRspError(CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///订阅行情应答
void OnRspSubMarketData(CThostFtdcSpecificInstrumentField* pSpecificInstrument, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///取消订阅行情应答
void OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField* pSpecificInstrument, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///订阅询价应答
void OnRspSubForQuoteRsp(CThostFtdcSpecificInstrumentField* pSpecificInstrument, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///取消订阅询价应答
void OnRspUnSubForQuoteRsp(CThostFtdcSpecificInstrumentField* pSpecificInstrument, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///深度行情通知
void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField* pDepthMarketData);

///询价通知
void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField* pForQuoteRsp);

//中心类指针
class_center* center_p;
};
//行情SPI类定义完毕


//交易类定义开始
class class_trader_spi :
public CThostFtdcTraderSpi
{
public:
class_trader_spi(class class_center*);

virtual ~class_trader_spi();

///当客户端与交易后台建立起通信连接时（还未登录前），该方法被调用。
void OnFrontConnected();

///当客户端与交易后台通信连接断开时，该方法被调用。当发生这个情况后，API会自动重新连接，客户端可不做处理。
///@param nReason 错误原因
///        0x1001 网络读失败
///        0x1002 网络写失败
///        0x2001 接收心跳超时
///        0x2002 发送心跳失败
///        0x2003 收到错误报文
void OnFrontDisconnected(int nReason);

///心跳超时警告。当长时间未收到报文时，该方法被调用。
///@param nTimeLapse 距离上次接收报文的时间
void OnHeartBeatWarning(int nTimeLapse);

///客户端认证响应
void OnRspAuthenticate(CThostFtdcRspAuthenticateField* pRspAuthenticateField, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);


///登录请求响应
void OnRspUserLogin(CThostFtdcRspUserLoginField* pRspUserLogin, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///登出请求响应
void OnRspUserLogout(CThostFtdcUserLogoutField* pUserLogout, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///用户口令更新请求响应
void OnRspUserPasswordUpdate(CThostFtdcUserPasswordUpdateField* pUserPasswordUpdate, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///资金账户口令更新请求响应
void OnRspTradingAccountPasswordUpdate(CThostFtdcTradingAccountPasswordUpdateField* pTradingAccountPasswordUpdate, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///报单录入请求响应
void OnRspOrderInsert(CThostFtdcInputOrderField* pInputOrder, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///预埋单录入请求响应
void OnRspParkedOrderInsert(CThostFtdcParkedOrderField* pParkedOrder, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///预埋撤单录入请求响应
void OnRspParkedOrderAction(CThostFtdcParkedOrderActionField* pParkedOrderAction, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///报单操作请求响应
void OnRspOrderAction(CThostFtdcInputOrderActionField* pInputOrderAction, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///查询最大报单数量响应
void OnRspQryMaxOrderVolume(CThostFtdcQryMaxOrderVolumeField* pQryMaxOrderVolume, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///投资者结算结果确认响应
void OnRspSettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField* pSettlementInfoConfirm, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///删除预埋单响应
void OnRspRemoveParkedOrder(CThostFtdcRemoveParkedOrderField* pRemoveParkedOrder, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///删除预埋撤单响应
void OnRspRemoveParkedOrderAction(CThostFtdcRemoveParkedOrderActionField* pRemoveParkedOrderAction, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///执行宣告录入请求响应
void OnRspExecOrderInsert(CThostFtdcInputExecOrderField* pInputExecOrder, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///执行宣告操作请求响应
void OnRspExecOrderAction(CThostFtdcInputExecOrderActionField* pInputExecOrderAction, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///询价录入请求响应
void OnRspForQuoteInsert(CThostFtdcInputForQuoteField* pInputForQuote, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///报价录入请求响应
void OnRspQuoteInsert(CThostFtdcInputQuoteField* pInputQuote, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///报价操作请求响应
void OnRspQuoteAction(CThostFtdcInputQuoteActionField* pInputQuoteAction, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///批量报单操作请求响应
void OnRspBatchOrderAction(CThostFtdcInputBatchOrderActionField* pInputBatchOrderAction, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///期权自对冲录入请求响应
void OnRspOptionSelfCloseInsert(CThostFtdcInputOptionSelfCloseField* pInputOptionSelfClose, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///期权自对冲操作请求响应
void OnRspOptionSelfCloseAction(CThostFtdcInputOptionSelfCloseActionField* pInputOptionSelfCloseAction, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///申请组合录入请求响应
void OnRspCombActionInsert(CThostFtdcInputCombActionField* pInputCombAction, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询报单响应
void OnRspQryOrder(CThostFtdcOrderField* pOrder, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询成交响应
void OnRspQryTrade(CThostFtdcTradeField* pTrade, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询投资者持仓响应
void OnRspQryInvestorPosition(CThostFtdcInvestorPositionField* pInvestorPosition, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询资金账户响应
void OnRspQryTradingAccount(CThostFtdcTradingAccountField* pTradingAccount, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询投资者响应
void OnRspQryInvestor(CThostFtdcInvestorField* pInvestor, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询交易编码响应
void OnRspQryTradingCode(CThostFtdcTradingCodeField* pTradingCode, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询合约保证金率响应
void OnRspQryInstrumentMarginRate(CThostFtdcInstrumentMarginRateField* pInstrumentMarginRate, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询合约手续费率响应
void OnRspQryInstrumentCommissionRate(CThostFtdcInstrumentCommissionRateField* pInstrumentCommissionRate, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询交易所响应
void OnRspQryExchange(CThostFtdcExchangeField* pExchange, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询产品响应
void OnRspQryProduct(CThostFtdcProductField* pProduct, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询合约响应
void OnRspQryInstrument(CThostFtdcInstrumentField* pInstrument, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询行情响应
void OnRspQryDepthMarketData(CThostFtdcDepthMarketDataField* pDepthMarketData, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询投资者结算结果响应
void OnRspQrySettlementInfo(CThostFtdcSettlementInfoField* pSettlementInfo, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询转帐银行响应
void OnRspQryTransferBank(CThostFtdcTransferBankField* pTransferBank, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询投资者持仓明细响应
void OnRspQryInvestorPositionDetail(CThostFtdcInvestorPositionDetailField* pInvestorPositionDetail, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询客户通知响应
void OnRspQryNotice(CThostFtdcNoticeField* pNotice, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询结算信息确认响应
void OnRspQrySettlementInfoConfirm(CThostFtdcSettlementInfoConfirmField* pSettlementInfoConfirm, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询投资者持仓明细响应
void OnRspQryInvestorPositionCombineDetail(CThostFtdcInvestorPositionCombineDetailField* pInvestorPositionCombineDetail, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///查询保证金监管系统经纪公司资金账户密钥响应
void OnRspQryCFMMCTradingAccountKey(CThostFtdcCFMMCTradingAccountKeyField* pCFMMCTradingAccountKey, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询仓单折抵信息响应
void OnRspQryEWarrantOffset(CThostFtdcEWarrantOffsetField* pEWarrantOffset, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询投资者品种/跨品种保证金响应
void OnRspQryInvestorProductGroupMargin(CThostFtdcInvestorProductGroupMarginField* pInvestorProductGroupMargin, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询交易所保证金率响应
void OnRspQryExchangeMarginRate(CThostFtdcExchangeMarginRateField* pExchangeMarginRate, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询交易所调整保证金率响应
void OnRspQryExchangeMarginRateAdjust(CThostFtdcExchangeMarginRateAdjustField* pExchangeMarginRateAdjust, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询汇率响应
void OnRspQryExchangeRate(CThostFtdcExchangeRateField* pExchangeRate, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询二级代理操作员银期权限响应
void OnRspQrySecAgentACIDMap(CThostFtdcSecAgentACIDMapField* pSecAgentACIDMap, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询产品报价汇率
void OnRspQryProductExchRate(CThostFtdcProductExchRateField* pProductExchRate, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询产品组
void OnRspQryProductGroup(CThostFtdcProductGroupField* pProductGroup, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询做市商合约手续费率响应
void OnRspQryMMInstrumentCommissionRate(CThostFtdcMMInstrumentCommissionRateField* pMMInstrumentCommissionRate, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询做市商期权合约手续费响应
void OnRspQryMMOptionInstrCommRate(CThostFtdcMMOptionInstrCommRateField* pMMOptionInstrCommRate, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询报单手续费响应
void OnRspQryInstrumentOrderCommRate(CThostFtdcInstrumentOrderCommRateField* pInstrumentOrderCommRate, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询资金账户响应
void OnRspQrySecAgentTradingAccount(CThostFtdcTradingAccountField* pTradingAccount, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询二级代理商资金校验模式响应
void OnRspQrySecAgentCheckMode(CThostFtdcSecAgentCheckModeField* pSecAgentCheckMode, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询期权交易成本响应
void OnRspQryOptionInstrTradeCost(CThostFtdcOptionInstrTradeCostField* pOptionInstrTradeCost, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询期权合约手续费响应
void OnRspQryOptionInstrCommRate(CThostFtdcOptionInstrCommRateField* pOptionInstrCommRate, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询执行宣告响应
void OnRspQryExecOrder(CThostFtdcExecOrderField* pExecOrder, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询询价响应
void OnRspQryForQuote(CThostFtdcForQuoteField* pForQuote, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询报价响应
void OnRspQryQuote(CThostFtdcQuoteField* pQuote, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询期权自对冲响应
void OnRspQryOptionSelfClose(CThostFtdcOptionSelfCloseField* pOptionSelfClose, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询投资单元响应
void OnRspQryInvestUnit(CThostFtdcInvestUnitField* pInvestUnit, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询组合合约安全系数响应
void OnRspQryCombInstrumentGuard(CThostFtdcCombInstrumentGuardField* pCombInstrumentGuard, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询申请组合响应
void OnRspQryCombAction(CThostFtdcCombActionField* pCombAction, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询转帐流水响应
void OnRspQryTransferSerial(CThostFtdcTransferSerialField* pTransferSerial, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询银期签约关系响应
void OnRspQryAccountregister(CThostFtdcAccountregisterField* pAccountregister, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///错误应答
void OnRspError(CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///报单通知
void OnRtnOrder(CThostFtdcOrderField* pOrder);

///成交通知
void OnRtnTrade(CThostFtdcTradeField* pTrade);

///报单录入错误回报
void OnErrRtnOrderInsert(CThostFtdcInputOrderField* pInputOrder, CThostFtdcRspInfoField* pRspInfo);

///报单操作错误回报
void OnErrRtnOrderAction(CThostFtdcOrderActionField* pOrderAction, CThostFtdcRspInfoField* pRspInfo);

///合约交易状态通知
void OnRtnInstrumentStatus(CThostFtdcInstrumentStatusField* pInstrumentStatus);

///交易所公告通知
void OnRtnBulletin(CThostFtdcBulletinField* pBulletin);

///交易通知
void OnRtnTradingNotice(CThostFtdcTradingNoticeInfoField* pTradingNoticeInfo);

///提示条件单校验错误
void OnRtnErrorConditionalOrder(CThostFtdcErrorConditionalOrderField* pErrorConditionalOrder);

///执行宣告通知
void OnRtnExecOrder(CThostFtdcExecOrderField* pExecOrder);

///执行宣告录入错误回报
void OnErrRtnExecOrderInsert(CThostFtdcInputExecOrderField* pInputExecOrder, CThostFtdcRspInfoField* pRspInfo);

///执行宣告操作错误回报
void OnErrRtnExecOrderAction(CThostFtdcExecOrderActionField* pExecOrderAction, CThostFtdcRspInfoField* pRspInfo);

///询价录入错误回报
void OnErrRtnForQuoteInsert(CThostFtdcInputForQuoteField* pInputForQuote, CThostFtdcRspInfoField* pRspInfo);

///报价通知
void OnRtnQuote(CThostFtdcQuoteField* pQuote);

///报价录入错误回报
void OnErrRtnQuoteInsert(CThostFtdcInputQuoteField* pInputQuote, CThostFtdcRspInfoField* pRspInfo);

///报价操作错误回报
void OnErrRtnQuoteAction(CThostFtdcQuoteActionField* pQuoteAction, CThostFtdcRspInfoField* pRspInfo);

///询价通知
void OnRtnForQuoteRsp(CThostFtdcForQuoteRspField* pForQuoteRsp);

///保证金监控中心用户令牌
void OnRtnCFMMCTradingAccountToken(CThostFtdcCFMMCTradingAccountTokenField* pCFMMCTradingAccountToken);

///批量报单操作错误回报
void OnErrRtnBatchOrderAction(CThostFtdcBatchOrderActionField* pBatchOrderAction, CThostFtdcRspInfoField* pRspInfo);

///期权自对冲通知
void OnRtnOptionSelfClose(CThostFtdcOptionSelfCloseField* pOptionSelfClose);

///期权自对冲录入错误回报
void OnErrRtnOptionSelfCloseInsert(CThostFtdcInputOptionSelfCloseField* pInputOptionSelfClose, CThostFtdcRspInfoField* pRspInfo);

///期权自对冲操作错误回报
void OnErrRtnOptionSelfCloseAction(CThostFtdcOptionSelfCloseActionField* pOptionSelfCloseAction, CThostFtdcRspInfoField* pRspInfo);

///申请组合通知
void OnRtnCombAction(CThostFtdcCombActionField* pCombAction);

///申请组合录入错误回报
void OnErrRtnCombActionInsert(CThostFtdcInputCombActionField* pInputCombAction, CThostFtdcRspInfoField* pRspInfo);

///请求查询签约银行响应
void OnRspQryContractBank(CThostFtdcContractBankField* pContractBank, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询预埋单响应
void OnRspQryParkedOrder(CThostFtdcParkedOrderField* pParkedOrder, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询预埋撤单响应
void OnRspQryParkedOrderAction(CThostFtdcParkedOrderActionField* pParkedOrderAction, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询交易通知响应
void OnRspQryTradingNotice(CThostFtdcTradingNoticeField* pTradingNotice, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询经纪公司交易参数响应
void OnRspQryBrokerTradingParams(CThostFtdcBrokerTradingParamsField* pBrokerTradingParams, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询经纪公司交易算法响应
void OnRspQryBrokerTradingAlgos(CThostFtdcBrokerTradingAlgosField* pBrokerTradingAlgos, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///请求查询监控中心用户令牌
void OnRspQueryCFMMCTradingAccountToken(CThostFtdcQueryCFMMCTradingAccountTokenField* pQueryCFMMCTradingAccountToken, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///银行发起银行资金转期货通知
void OnRtnFromBankToFutureByBank(CThostFtdcRspTransferField* pRspTransfer);

///银行发起期货资金转银行通知
void OnRtnFromFutureToBankByBank(CThostFtdcRspTransferField* pRspTransfer);

///银行发起冲正银行转期货通知
void OnRtnRepealFromBankToFutureByBank(CThostFtdcRspRepealField* pRspRepeal);

///银行发起冲正期货转银行通知
void OnRtnRepealFromFutureToBankByBank(CThostFtdcRspRepealField* pRspRepeal);

///期货发起银行资金转期货通知
void OnRtnFromBankToFutureByFuture(CThostFtdcRspTransferField* pRspTransfer);

///期货发起期货资金转银行通知
void OnRtnFromFutureToBankByFuture(CThostFtdcRspTransferField* pRspTransfer);

///系统运行时期货端手工发起冲正银行转期货请求，银行处理完毕后报盘发回的通知
void OnRtnRepealFromBankToFutureByFutureManual(CThostFtdcRspRepealField* pRspRepeal);

///系统运行时期货端手工发起冲正期货转银行请求，银行处理完毕后报盘发回的通知
void OnRtnRepealFromFutureToBankByFutureManual(CThostFtdcRspRepealField* pRspRepeal);

///期货发起查询银行余额通知
void OnRtnQueryBankBalanceByFuture(CThostFtdcNotifyQueryAccountField* pNotifyQueryAccount);

///期货发起银行资金转期货错误回报
void OnErrRtnBankToFutureByFuture(CThostFtdcReqTransferField* pReqTransfer, CThostFtdcRspInfoField* pRspInfo);

///期货发起期货资金转银行错误回报
void OnErrRtnFutureToBankByFuture(CThostFtdcReqTransferField* pReqTransfer, CThostFtdcRspInfoField* pRspInfo);

///系统运行时期货端手工发起冲正银行转期货错误回报
void OnErrRtnRepealBankToFutureByFutureManual(CThostFtdcReqRepealField* pReqRepeal, CThostFtdcRspInfoField* pRspInfo);

///系统运行时期货端手工发起冲正期货转银行错误回报
void OnErrRtnRepealFutureToBankByFutureManual(CThostFtdcReqRepealField* pReqRepeal, CThostFtdcRspInfoField* pRspInfo);

///期货发起查询银行余额错误回报
void OnErrRtnQueryBankBalanceByFuture(CThostFtdcReqQueryAccountField* pReqQueryAccount, CThostFtdcRspInfoField* pRspInfo);

///期货发起冲正银行转期货请求，银行处理完毕后报盘发回的通知
void OnRtnRepealFromBankToFutureByFuture(CThostFtdcRspRepealField* pRspRepeal);

///期货发起冲正期货转银行请求，银行处理完毕后报盘发回的通知
void OnRtnRepealFromFutureToBankByFuture(CThostFtdcRspRepealField* pRspRepeal);

///期货发起银行资金转期货应答
void OnRspFromBankToFutureByFuture(CThostFtdcReqTransferField* pReqTransfer, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///期货发起期货资金转银行应答
void OnRspFromFutureToBankByFuture(CThostFtdcReqTransferField* pReqTransfer, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///期货发起查询银行余额应答
void OnRspQueryBankAccountMoneyByFuture(CThostFtdcReqQueryAccountField* pReqQueryAccount, CThostFtdcRspInfoField* pRspInfo, int nRequestID, bool bIsLast);

///银行发起银期开户通知
void OnRtnOpenAccountByBank(CThostFtdcOpenAccountField* pOpenAccount);

///银行发起银期销户通知
void OnRtnCancelAccountByBank(CThostFtdcCancelAccountField* pCancelAccount);

///银行发起变更银行账号通知
void OnRtnChangeAccountByBank(CThostFtdcChangeAccountField* pChangeAccount);


	///请求查询分类合约响应
void OnRspQryClassifiedInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);

///请求组合优惠比例响应
void OnRspQryCombPromotionParam(CThostFtdcCombPromotionParamField *pCombPromotionParam, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);

///投资者风险结算持仓查询响应
void OnRspQryRiskSettleInvstPosition(CThostFtdcRiskSettleInvstPositionField *pRiskSettleInvstPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);

///风险结算产品查询响应
void OnRspQryRiskSettleProductStatus(CThostFtdcRiskSettleProductStatusField *pRiskSettleProductStatus, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);


///SPBM期货合约参数查询响应
void OnRspQrySPBMFutureParameter(CThostFtdcSPBMFutureParameterField *pSPBMFutureParameter, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);

///SPBM期权合约参数查询响应
void OnRspQrySPBMOptionParameter(CThostFtdcSPBMOptionParameterField *pSPBMOptionParameter, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);

///SPBM品种内对锁仓折扣参数查询响应
void OnRspQrySPBMIntraParameter(CThostFtdcSPBMIntraParameterField *pSPBMIntraParameter, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);

///SPBM跨品种抵扣参数查询响应
void OnRspQrySPBMInterParameter(CThostFtdcSPBMInterParameterField *pSPBMInterParameter, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);

///SPBM组合保证金套餐查询响应
void OnRspQrySPBMPortfDefinition(CThostFtdcSPBMPortfDefinitionField *pSPBMPortfDefinition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);

///投资者SPBM套餐选择查询响应
void OnRspQrySPBMInvestorPortfDef(CThostFtdcSPBMInvestorPortfDefField *pSPBMInvestorPortfDef, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);

///投资者新型组合保证金系数查询响应
void OnRspQryInvestorPortfMarginRatio(CThostFtdcInvestorPortfMarginRatioField *pInvestorPortfMarginRatio, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);

///投资者产品SPBM明细查询响应
void OnRspQryInvestorProdSPBMDetail(CThostFtdcInvestorProdSPBMDetailField *pInvestorProdSPBMDetail, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);

//private:
///中心类指针
class_center* center_p;
};

//行情SPI指针
class_md_spi *md_spi_p;
// 行情api指针
CThostFtdcMdApi* md_api_p;
//交易SPI指针
class_trader_spi* trader_spi_p;
// 交易api的实例化指针
CThostFtdcTraderApi* trader_api_p;
//结算单字符串
std::string SettlementInfo_str;
//路径，经纪商，用户，密码等
std::string path_str, broker_str, user_str, password_str,userproductinfo_str,authcode_str;
//交易日
std::string tradingday;
//假期列表
std::vector<std::string> holiday_list;
//操作引用，前置机，绘画，报单引用
int nrequestid, frontid, sessionid, orderref;
//开关数组
//0 程序运行
// 1  调试和或者生产环境
// 2  交易时段
// 3  是否发送消息
//5  行情前置机连接状态
//6  行情登录状态
//10  行情订阅状态
//11  订阅响应状态
//12  订阅响应数量
// 25  交易前置机连接状态
//26  交易登录状态
//27  请求查询结算信息确认响应 状态
//28  投资者结算结果确认响应 状态
//29  认证状态
//30  查询合约动作
//31  查询合约响应 状态
//32  查询持仓动作
//33  查询投资者持仓响应 状态
//34  查询资金动作
//35  查询资金账户响应 状态
// 50  策略状态
int flag[64];
//事件句柄数组
class_event handles[64];

std::set<std::string> md_front_list;//行情地址列表
std::set<std::string> trader_front_list;//交易前置机列表

//日志对象
class_log log;
//1分钟队列map
std::unordered_map<std::string,class_bars> bars_map;
//tick事件句柄
std::unordered_map<std::string, class_event> tick_event_map;
// 深度行情TICK数据
std::unordered_map<std::string, CThostFtdcDepthMarketDataField> tick_map;
//深度行情队列
std::unordered_map<std::string,class_tick> ticks_map;

//合约map
std::unordered_map<std::string,CThostFtdcInstrumentField> hy_map;
//查询资金账户响应
CThostFtdcTradingAccountField trading_account;
//持仓
std::map<std::string,class_position> position_map;
//交易状态通知内容
std::unordered_map<std::string, CThostFtdcInstrumentStatusField> instrument_status_map;
//行情交易状态
std::unordered_map<std::string,TThostFtdcInstrumentStatusType> tick_status_map;
//报单录入请求响应map
std::unordered_map<int,CThostFtdcInputOrderField> InputOrder_map;

 
//中心类构造函数
class_center();
//中心类析构函数
~class_center();

//中心类启动函数
void run(std::string, std::string, std::string, std::string, std::string,std::string);

//循环函数
static unsigned int circle(class_center* arg);
//县城对象
std::thread circle_thread;

//初始化
int init();

//报单
int bd(TThostFtdcInstrumentIDType dm, char dk, const char  kp[5], double price, int value,class_strategy_position &);

//报单自动
int bd_auto(TThostFtdcInstrumentIDType dm, char dk, double price, int value,class_strategy_position &);

//同步策略持仓
int position_sync(class_strategy_position &);

//清理策略返回值
int return_erase(class_strategy_position &);

// 撤单
int cd(class_strategy_position&);
//合成key
std::string synthesize_key(int frontid, int sessionid, char orderref[]);
//转码对象
class_zm zm;
//主力合约对象
std::map<std::string,std::vector<CThostFtdcDepthMarketDataField> > hot_map_vector;
//更新主力合约
int up_hot();
};

